<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="/tpshop/Public/common/js/jquery-3.1.1.min.js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			.left div{
				display: none;
			}
		</style>
		<script type="text/javascript">
			$(function(){
				
				
			});
		</script>
	</head>
	<body>
		<header>
			<div>
				<ul>
					<li><a href="">清除缓存</a></li>
					<li>
						<a href="">后台管理</a>
						<ul>
							<li><a href="">Admin</a></li>
							<li><a href="">修改密码</a></li>
							<li><a href="">前台首页</a></li>
							<li><a href="">退出</a></li>
						</ul>
					</li>
				</ul>
			</div>
		</header>
		
		<!--内容区域-->
		<div class="main">
			<div class="left">
				<h2 id="Admin">管理员管理</h2>
				<div class="item">
					<p><a href="<?php echo U('Admin/index');?>">管理员列表</a></p>
				</div>
				
				<h2 id="User">用户管理</h2>
				<div class="item">
					<ul>
						<li><a href="<?php echo U('User/index');?>">用户列表</a></li>
					</ul>
				</div>
				
				<h2 id="User">分类管理</h2>
				<div class="item">
					<ul>
						<li><a href="<?php echo U('Types/index');?>">分类列表</a></li>
					</ul>
				</div>
				
				<h2 id="User">系统管理</h2>
				<div class="item">
					<ul>
						<li><a href="<?php echo U('Sys/index');?>">系统配置</a></li>
						<li><a href="<?php echo U('Sys/lunbo_list');?>">轮播图列表</a></li>
					</ul>
				</div>
			</div>
			
			<div class="right">
				

<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<span id="refresh" onclick="location.href=location.href">
			
		</span>
		<a href="<?php echo U('lunbo_add');?>">添加</a>
		<table border="" cellspacing="" cellpadding="">
			<tr>
				<th>ID</th>
				<th>NAME</th>
				<th>Sort</th>
				<th>img</th>
				<th>Url</th>
				<th>操作</th>
			</tr>
			<?php if(is_array($data)): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$row): $mod = ($i % 2 );++$i;?><tr>
				<td><?php echo ($row[id]); ?></td>
				<td><?php echo ($row[name]); ?></td>
				<td><input type="text" name="" id="" value="<?php echo ($row[sort]); ?>" onblur="sorts(this,<?php echo ($row[id]); ?>)" /></td>
				<td><img width="50" height="50" src="/tpshop/Uploads/<?php echo ($row[img]); ?>" /></td>
				<td><?php echo ($row[url]); ?></td>
				<td>
					<a href="<?php echo U('lunbo_edit',array('id'=>$row['id']));?>">编辑</a>
					<a href="javascript:;" onclick="del(this,<?php echo ($row['id']); ?>)">删除</a>
				</td>
			</tr><?php endforeach; endif; else: echo "" ;endif; ?>
			
		</table>
		<?php echo ($total); ?>
		<nav>
			<?php echo ($page); ?>
		</nav>
	</body>
	<script type="text/javascript">
		function sorts(obj,id){
			var val = $(obj).val();
//			console.log(val);
			$.post("<?php echo U('ajax_sorts');?>", {id:id, sort:val}, function(data){
				if(data == 1){
					$("#refresh").click();
				}else{
					alert("排序失败");
				}
			});
		}
		
		function del(obj,id){	
			$.post("<?php echo U('ajax_del');?>", {id:id}, function(data){
				if(data == 1){
					$(obj).parent().parent().remove();
				}else{
					alert("删除失败");
				}
			});
		}
	</script>
</html>

			</div>
			
		</div>
			
	</body>
	<script type="text/javascript">
		$(".left h2").click(function(){
			$(this).next().toggle(300);
			$('.left div').not($(this).next()).hide(300);
//					$(".item ul").hide();
//					$(this).parent().next().toggle(500);
				});
				var cName = "<?php echo (CONTROLLER_NAME); ?>";
				$("#" + cName).click();
	</script>
</html>